<?php

namespace app\helpers;

use Yii;

class ValidateHelper
{
    /**
     * @param $phoneNumber
     * @return bool
     */
    public static function validatePhoneNumber($phoneNumber)
    {
        $preg_phone = '/^1[34578]\d{9}$/ims';
        if (preg_match($preg_phone, $phoneNumber)) {
            return true;
        }else{
            return false;
        }
    }

    public static function validateEmail($email)
    {
        $preg_email = '/^[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*@([a-zA-Z0-9]+[-.])+([a-z]{2,5})$/ims';
        if (preg_match($preg_email, $email)) {
            return true;
        }else{
            return false;
        }
    }
}
